<?php echo CHtml::errorSummary($model); ?>
<div style="width:500px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'date'); ?>
<?php $this->widget('application.widgets.jui.EDatePicker',
              array(
                    'name'=>'invoice[date]',
                    'fontSize'=>'1em',
                    'mode'=>'focus',
                    'theme'=>'flick',
                    'value'=>($model['date'] != '')?$model['date']:date('d/m/Y'),
                    'htmlOptions'=>array('size'=>30),
                   )
             );
?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'amt'); ?>
<?php echo CHtml::activeTextField($model,'amt',array('size'=>30, 'maxlength'=>12)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'inv_no'); ?>
<?php echo CHtml::activeTextArea($model,'inv_no',array('cols'=>24,'rows'=>3)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'po_no'); ?>
<?php echo CHtml::activeTextArea($model,'po_no',array('cols'=>24,'rows'=>3)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'do_no'); ?>
<?php echo CHtml::activeTextArea($model,'do_no',array('cols'=>24,'rows'=>3)); ?>
</div>
</div>
<?php
$jsScript = "$('#cargo_form').bind('submit',function(){
    var gridid = $('#invoice_grid').getDataIDs();
    var data = new Array();
    for(var i=0;i<gridid.length;i++) {
        var currentrow = $('#invoice_grid').getRowData(gridid[i]);
        data[i] = new Array(currentrow['invoice[date]'],currentrow['invoice[inv_no]'],currentrow['invoice[po_no]'],currentrow['invoice[do_no]'],currentrow['invoice[amt]']);
}
$('#invoice_grid_data').val(data.toString());
return true;
})";
$cs = Yii::app()->clientScript;
$cs->registerScript("cargo_form#invoice_grid",$jsScript);
?>